﻿<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
		
	</head>
	<body>
		<div ng-app="myApp" ng-controller="myCtrl"> 

			<p>现在时间是:</p>

			<h1>{{theTime}}</h1>

		</div>

			<p>$interval 访问在指定的周期(以毫秒计)来调用函数或计算表达式。</p>

		<script>
			var app = angular.module('myApp', []);
			app.controller('myCtrl', function($scope, $interval) {
			  $scope.theTime = new Date().toLocaleTimeString();
			  $interval(function () {
				  $scope.theTime = new Date().toLocaleTimeString();
			  }, 1000);
			});
		</script>
	</body>
</html>
